//
//  TableVCVM+RowCell.m
//  
//  jhf
//
//  Created by Mac on 2020/7/23.
//  Copyright © 2020 jhfappkf@163.com. All rights reserved.
//

#import "TableVCVM+RowCell.h"
#import "RowBaseM.h"

@implementation TableVCVM (RowCell)

// MARK: - default rows
- (Row *)lineClearRow:(CGFloat)height; {
    RowBaseM *info = [RowBaseM defaultM];
    Row *row = [self genRowClassStr:@"RowBaseCell" model:info];
    row.height = height;
    return row;
}

- (Row *)lineColorRow:(NSString *)hex height:(CGFloat)height {
    RowBaseM *info = [RowBaseM defaultM];
    info.bgControl.vBgColorHex = hex;
    Row *row = [self genRowClassStr:@"RowBaseCell" model:info];
    row.height = height;
    return row;
}

//MARK: - 图文
- (Row *)imageTextRow:(RowTitleBaseM *)inputControl; {
    return [self genRowClassStr:@"RowImageLabelCell" model:inputControl];
}

//MARK: - 文本
- (Row *)textRow:(RowTitleBaseM *)textControl; {
    return [self genRowClassStr:@"RowLabelCell" model:textControl];
}


// MARK: - input rows
- (Row *)inputTFRow:(RowInputBaseM *)inputControl; {
    //    RowInputBaseM *inputControl = [RowInputBaseM defaultConfigTitle:@"真实姓名" value:@""];
    //        inputControl.leftImgControl = [ImageControlM defaultIMGName:@"icon_notice"];
    //    //    inputControl.leftImgControl.vHeightCons = 32;
    //    //    inputControl.leftImgControl.vWidthCons = 32;
    
    //        inputControl.titleLBControl.vTopCons = 32;
    //        inputControl.titleLBControl.vLeftCons = 54;
    //        inputControl.titleLBControl.textStrFont = [UIFont systemFontOfSize:17 weight:UIFontWeightBold];
    
    //        inputControl.rightLBControl = [LabelControlM defaultText:@"张三"];
    //        inputControl.rightLBControl.vRightCons = 32;
    
    //        inputControl.bottomLineControl.vHeightCons = 1;
    //        inputControl.bottomLineControl.vBgColorHex = @"#ff5566";
    
    //        inputControl.rightImgControl = [ImageControlM defaultIMGName:@"icon_func_rightarrow"];
    //        inputControl.rightImgControl.vRightCons = 8;
    
    return [self genRowClassStr:@"RowTextFiledCell" model:inputControl];
}

- (Row *)inputTVRow:(RowInputBaseM *)inputControl; {
    //    RowInputBaseM *inputControl = [RowInputBaseM defaultConfigTitle:@"标题" value:@""];
    //    inputControl.titleLBControl.textTextAlignment = NSTextAlignmentRight;
    //    inputControl.titleLBControl.vWidthCons = 60;
    //    inputControl.titleLBControl.vBgColorHex = @"#f5f6f7";
    //    inputControl.dataKey = @"key2";
    //
    //    inputControl.inputControl.maxLength = 4;
    //    inputControl.inputControl.vLeftCons = 12;
    //    inputControl.bottomLineControl.vHeightCons = 1;
    //
    //    inputControl.rightImgControl = [ImageControlM defaultIMGName:@"icon_func_rightarrow"];
    //    inputControl.rightImgControl.vBgColor = [UIColor randomColor];
    //    inputControl.rightImgControl.vWidthCons = 32;
    //    inputControl.rightImgControl.vHeightCons = 32;
    //    inputControl.rightImgControl.vRightCons = 4;
    //
    //    inputControl.leftImgControl = [ImageControlM defaultIMGName:@"icon_func_rightarrow"];
    //    inputControl.leftImgControl.vBgColor = [UIColor randomColor];
    //    inputControl.leftImgControl.vWidthCons = 32;
    //    inputControl.leftImgControl.vHeightCons = 32;
    //    inputControl.leftImgControl.vLeftCons = 4;
    //
    return [self genRowClassStr:@"RowTextViewCell" model:inputControl];
}

- (Row *)inputColumnTVRow:(RowInputBaseM *)inputControl; {
    
//    RowInputBaseM *config = [RowInputBaseM defaultConfigTitle:@"标题" value:@""];
//
//    config.titleLBControl.textStrFont = [UIFont systemFontOfSize:15 weight:UIFontWeightHeavy];
//
//    config.inputControl.vBgColor = [UIColor colorWithHexString:@"#f2f3f4"];
//    config.inputControl.vRadius = 8;
//    config.inputControl.vMinHeightCons = 200;
//    config.inputControl.maxLength = 500;
//
//    LabelControlM *countLBControl = [LabelControlM defaultText:@""];
//    countLBControl.textColorHex = @"#666666";
//    config.countLBControl = countLBControl;
    
    inputControl.inputControl.vMasksToBounds = true;
    return [self genRowClassStr:@"RowTitleTextViewColumnCell" model:inputControl];
}

// MARK: - btn rows
- (Row *)btnsShowRow:(NSArray <ButtonControlM *> *)arr; {
    //    [ButtonControlM defaultBTText:@"bt1"];
    Row *row = [self genRowClassStr:@"RowBTCell" model:arr];
    row.height = [ButtonControlM ideaHeight:arr];
    return row;
}


// MARK: - webview rows
- (Row *)webShowRow:(WKWebControlM*)webControl; {
    //    WKWebControlM *webControl = [WKWebControlM defaultControlUrl:@"https://www.baidu.com"];
    return [self genRowClassStr:@"RowWKWebCell" model:webControl];
}

// MARK: - images rows
- (Row *)imageShowRow:(RowImageBaseM *)info; {
    //    NSString *strs = [NSString stringWithFormat:@"https://dss1.bdstatic.com/kvoZeXSm1A5BphGlnYG/skin_zoom/%d.jpg", self.index + 200];
    //    ImageControlM *controlIMG = [ImageControlM defaultIMGUrl:strs];
    //    RowImageBaseM *base = [RowImageBaseM defaultControl:controlIMG];
    //    base.bgVMarging = UIEdgeInsetsMake(4, 4, 4, 4);
    //    base.bgControl.vBgColorHex = @"#ff6677";
    return [self genRowClassStr:@"RowImageCell" model:info];
}

- (Row *)imagesShowRow:(RowImagesBaseM *)info; {
    //    NSMutableArray *imagesArray = [NSMutableArray array];
    //    for (int i = 0; i < self.index/10; i++) {
    //        NSString *strs = [NSString stringWithFormat:@"https://dss1.bdstatic.com/kvoZeXSm1A5BphGlnYG/skin_zoom/%d.jpg", self.index + i];
    //        ImageControlM *controlIMG = [ImageControlM defaultIMGUrl:strs];
    //        controlIMG.vRadius = 4;
    //        controlIMG.vMasksToBounds = true;
    //        controlIMG.vTopCons = 4;
    //        controlIMG.vLeftCons = 4;
    //        controlIMG.vBottomCons = 4;
    //        controlIMG.vWidthCons = (kScreen_Width - 20)/4.0;
    //        controlIMG.vHeightCons = (kScreen_Width - 20)/4.0;
    //        controlIMG.vBgColorHex = @"#ff6677";
    //        [imagesArray addObject:controlIMG];
    //    }
    Row *row = [self genRowClassStr:@"RowImagesCell" model:info];
    if (info.cellHeight > 0) {
        row.height = info.cellHeight;
    }
    return row;
}

- (Row *)imagesPickerRow:(RowUploadImagesM *)info; {
//    RowUploadImagesM *uplaod = [RowUploadImagesM defaultAddImageName:@"btn_add" dataKey:@"files"];
//    CGFloat cellW = (kScreen_Width - 40)/4.0;
//    uplaod.cellSize = CGSizeMake(cellW, cellW);
//    uplaod.numberOfVertail = 1;
//    uplaod.numberOfVertail = 4;
//    uplaod.sectionInset = UIEdgeInsetsMake(8, 8, 8, 8);
//    uplaod.deleteImage = @"evaluate_btn_delete";
    return [self genRowClassStr:@"RowUploadImagesCell" model:info];
}

@end
